import time
import sqlobject
from coptur.database import *

class Task(sqlobject.SQLObject):

    _connection = connection.connect

    name = sqlobject.StringCol(length=255, default="Task-%s" % time.strftime("%Y%m%d%H%I%S") )
    scan_type = sqlobject.IntCol(default=2) # 1 host 2 web 3 whole
    targets = sqlobject.StringCol(length=255)
    options = sqlobject.StringCol()
    hosts = sqlobject.MultipleJoin('Site', joinColumn='task_id')
    sites = sqlobject.MultipleJoin('Host', joinColumn='task_id')
    #entry = sqlobject.StringCol(length=255)
    #urls = sqlobject.MultipleJoin('Url', joinColumn='site_id')

# create table if not exists
Task.createTable(ifNotExists=True)
